package com.example;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.samples.*;

/**
 * Created with IntelliJ IDEA.
 * User: Andrei
 * Date: 7/29/12
 * Time: 9:35 PM
 * To change this template use File | Settings | File Templates.
 */
public class MainActivity extends Activity {
    private Button btnExampleFrame;
    private Button btnExampleTransitionVertical;
    private Button btnExampleSlideViewHorizontal;
    private Button btnEcampleRotateAndScale;
    private Button btnExampleDynamic;
    private Button btnExampleTransitionFlip;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        setupUI();
        setupListeners();
    }

    private void setupUI() {
        btnExampleFrame = (Button) findViewById(R.id.example_frame);
        btnExampleTransitionVertical = (Button) findViewById(R.id.example_transition_vertical);
        btnExampleTransitionFlip = (Button) findViewById(R.id.example_flip);
        btnExampleSlideViewHorizontal = (Button) findViewById(R.id.example_slide_view_horizontal);
        btnEcampleRotateAndScale = (Button) findViewById(R.id.example_rotate_scale);
        btnExampleDynamic = (Button) findViewById(R.id.example_dynamic);
    }

    private void setupListeners() {
        btnExampleFrame.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this, ExampleFrame.class));
            }
        });
        btnExampleTransitionVertical.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this, ExampleTransitionUpDown.class));
                overridePendingTransition(R.anim.go_up, 0);
            }
        });
        btnExampleTransitionFlip.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this, ExampleTransitionUpDown.class));
                overridePendingTransition(R.anim.grow_from_middle, R.anim.shrink_to_middle);
            }
        });
        btnExampleSlideViewHorizontal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this, ExampleTextViewSlideHorizontal.class));
            }
        });
        btnEcampleRotateAndScale.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this, ExampleRotateAndScale.class));
            }
        });
        btnExampleDynamic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this, ExampleAnimationDynamic.class));
            }
        });
    }
}